package com.smartthinking.CICPNL.home.activity;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.os.Environment;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.smartthinking.CICPNL.R;

public class ImageFragment extends Fragment {
    private final String imageResourceId;
    public Utilities util;
    public Context ctx;
 
    public ImageFragment(String imageResourceId, Context context) {
        this.imageResourceId = imageResourceId;
        ctx = context;
    }
    
 
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
    }
 
    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
 
    }
 
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.image_layout, container, false);
        ImageView img = (ImageView) view.findViewById(R.id.imageView1);
        Log.i("Ruta_Img", "" + Environment.getExternalStorageDirectory() + "/Pediatria/" +  imageResourceId);
       
        
        BitmapFactory.Options bmpOptions = new BitmapFactory.Options();
        bmpOptions.inSampleSize = 2;
        Bitmap bmp = BitmapFactory.decodeFile(Environment.getExternalStorageDirectory() + "/Pediatria/" +  imageResourceId,bmpOptions);
        img.setImageBitmap(bmp);
        
        
//        util= new Utilities();
//        util.qryImg(ctx, imageResourceId, img);
        
        
        //imageView.setImageResource(imageResourceId);
        return view;
    }
}
